
DEBUG ?= yes

ifeq ($(DEBUG), yes)
 CPP_FLAGS = -Wall -g -O2
endif

BUILD ?= linux

ifeq ($(BUILD), windows)
 SDL_LIB = ../SDL-1.2.12/lib
 BIN_EXT = .exe
 LNK_OPT = -Wl,--enable-auto-import
endif

ifeq ($(BUILD), linux)
 SDL_LIB = /usr/include
 BIN_EXE = 
 LNK_OPT =
endif 

CPP = g++
INCLUDE = -I../2Desa/include
LIBPATH = -L../2Desa/lib -L$(SDL_LIB)
LIBS = -l2Desa -lSDLmain -lSDL -lSDL_image

.PHONY = all
all: main.cpp
	$(CPP) $(CPP_FLAGS) -c $(INCLUDE) -o main.po $<
	$(CPP) $(INCLUDE) $(LIBPATH) -o main$(BIN_EXE) main.po $(LIBS) $(LNK_OPT)

.PHONY = clean
clean:
	$(RM) -f *.po
	$(RM) -f main$(BIN_EXE)
